package co.com.inventarios.modelo;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Mngdoc entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "MNGDOC", schema = "MANAGER", uniqueConstraints = {})
public class Mngdoc implements java.io.Serializable {

	// Fields

	private MngdocId id;
	private Vinculado vinculado;
	private Label label;
	private Bodega bodega;
	private Dlluser dlluser;
	private Date docfecha;
	private String docccosto;
	private String docbodsale;
	private String docdetalle;
	private Timestamp doclogfec;
	private Set<Mngmcn> mngmcns = new HashSet<Mngmcn>(0);

	// Constructors

	/** default constructor */
	public Mngdoc() {
	}

	/** minimal constructor */
	public Mngdoc(MngdocId id, Vinculado vinculado, Bodega bodega,
			String docccosto, String docbodsale) {
		this.id = id;
		this.vinculado = vinculado;
		this.bodega = bodega;
		this.docccosto = docccosto;
		this.docbodsale = docbodsale;
	}

	/** full constructor */
	public Mngdoc(MngdocId id, Vinculado vinculado, Label label, Bodega bodega,
			Dlluser dlluser, Date docfecha, String docccosto,
			String docbodsale, String docdetalle, Timestamp doclogfec,
			Set<Mngmcn> mngmcns) {
		this.id = id;
		this.vinculado = vinculado;
		this.label = label;
		this.bodega = bodega;
		this.dlluser = dlluser;
		this.docfecha = docfecha;
		this.docccosto = docccosto;
		this.docbodsale = docbodsale;
		this.docdetalle = docdetalle;
		this.doclogfec = doclogfec;
		this.mngmcns = mngmcns;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "docempresa", column = @Column(name = "DOCEMPRESA", unique = false, nullable = false, insertable = true, updatable = true, length = 3)),
			@AttributeOverride(name = "docclase", column = @Column(name = "DOCCLASE", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "docvinkey", column = @Column(name = "DOCVINKEY", unique = false, nullable = false, insertable = true, updatable = true, length = 15)),
			@AttributeOverride(name = "doctipo", column = @Column(name = "DOCTIPO", unique = false, nullable = false, insertable = true, updatable = true, length = 4)),
			@AttributeOverride(name = "docnumero", column = @Column(name = "DOCNUMERO", unique = false, nullable = false, insertable = true, updatable = true, precision = 13, scale = 1)) })
	public MngdocId getId() {
		return this.id;
	}

	public void setId(MngdocId id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "DOCVINCULA", unique = false, nullable = false, insertable = true, updatable = true)
	public Vinculado getVinculado() {
		return this.vinculado;
	}

	public void setVinculado(Vinculado vinculado) {
		this.vinculado = vinculado;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY )
	@JoinColumn(name = "DOCESTADO", unique = false, nullable = true, insertable = true, updatable = true)
	public Label getLabel() {
		return this.label;
	}

	public void setLabel(Label label) {
		this.label = label;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "DOCBODENT", unique = false, nullable = false, insertable = true, updatable = true)
	public Bodega getBodega() {
		return this.bodega;
	}

	public void setBodega(Bodega bodega) {
		this.bodega = bodega;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "DOCLOGUSER", unique = false, nullable = true, insertable = true, updatable = true)
	public Dlluser getDlluser() {
		return this.dlluser;
	}

	public void setDlluser(Dlluser dlluser) {
		this.dlluser = dlluser;
	}

	@Column(name = "DOCLOGFEC", unique = false, nullable = true, insertable = true, updatable = true)
	public Timestamp getDoclogfec() {
		return this.doclogfec;
	}

	public void setDoclogfec(Timestamp doclogfec) {
		this.doclogfec = doclogfec;
	}
	
	@Temporal(TemporalType.DATE)
	@Column(name = "DOCFECHA", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public Date getDocfecha() {
		return this.docfecha;
	}

	public void setDocfecha(Date docfecha) {
		this.docfecha = docfecha;
	}

	@Column(name = "DOCCCOSTO", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public String getDocccosto() {
		return this.docccosto;
	}

	public void setDocccosto(String docccosto) {
		this.docccosto = docccosto;
	}

	@Column(name = "DOCBODSALE", unique = false, nullable = false, insertable = true, updatable = true, length = 15)
	public String getDocbodsale() {
		return this.docbodsale;
	}

	public void setDocbodsale(String docbodsale) {
		this.docbodsale = docbodsale;
	}

	@Column(name = "DOCDETALLE", unique = false, nullable = true, insertable = true, updatable = true, length = 3000)
	public String getDocdetalle() {
		return this.docdetalle;
	}

	public void setDocdetalle(String docdetalle) {
		this.docdetalle = docdetalle;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "mngdoc")
	public Set<Mngmcn> getMngmcns() {
		return this.mngmcns;
	}

	public void setMngmcns(Set<Mngmcn> mngmcns) {
		this.mngmcns = mngmcns;
	}

}